/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package skelbkim;

import com.thoughtworks.selenium.*;
import java.util.regex.Pattern;

/**
 *
 * @author laimis
 */
public class Skelbimas extends SeleneseTestCase {

    public void setUp() throws Exception {
        setUp("http://www.skelbimas.lt/", "*firefox");
    }

    public void newNotation(String noticeText, String phone, String name, String noticeTitle, String email) throws Exception {
        selenium.open("/skelbimas/NewPaslaugos.php");
        if (isPageLoude()) {
        selenium.type("Pavadinimas", noticeTitle);
        selenium.type("Tekstas", noticeText);
        selenium.type("Vardas", name);
        selenium.type("Email", email);
        selenium.type("Telefonas", phone);
        selenium.type("Miestas", "Klaipėda");
        selenium.click("//input[@type='image']");
        }
        selenium.stop();
    }
        private boolean isPageLoude() {
        boolean result = true;
        while (!selenium.isElementPresent("//tbody/tr[3]/td[2]/table/tbody/tr[2]/td/table/tbody/tr/td[2]/form/center[2]/b/input")) {
                selenium.waitForPageToLoad("5000");
        }
        return result;
    }
}